<template>
  <div>
    <a-radio-group v-model="barType" button-style="solid" v-if="graphTypeDictOptions.length>1">
      <template v-for="graphType in graphTypeDictOptions">
        <a-radio-button :key="graphType.value" :value="graphType.value">{{graphType.text}}</a-radio-button>
      </template>
    </a-radio-group>
    <chart :chartData="chartData" :head="head" :graphType="barType" :aliases="aliases" :title="graphTypeDictOptions.length===1 && title"/>
  </div>
</template>

<script>
import Chart from './Chart'
export default {
  name: 'TabGraphreportAutoChart',
  components: {
    Chart
  },
  props: ['chartData', 'head', 'graphTypeDictOptions', 'title', 'aliases'],
  data() {
    return {
      barType: ''
    }
  },
  mounted() {
    this.barType = this.graphTypeDictOptions[0] && this.graphTypeDictOptions[0].value
  },
  updated() {
    // this.barType = this.graphTypeDictOptions[0] && this.graphTypeDictOptions[0].value
  }
}
</script>
